#ifndef __MESH_H__
#define __MESH_H__

#include <vector>
#include <string>
#include <glm/glm.hpp>

#include "types.h"

struct aiScene;
struct aiMesh;

namespace Hope {

    class Texture;

    struct Vertex
    {
        glm::vec3 vertex;
        glm::vec3 normal;
        glm::vec2 texcoord;
    };

    struct MeshEntity
    {
        std::vector<Vertex> m_vertices;
        std::vector<uint32_t> m_indices;
    };
    
    class Mesh
    {
    public:
        Mesh(const std::string &filename);
        ~Mesh();

        bool init();

        bool initFromScene(const aiScene *pScene);

        void initMesh(uint32_t index, const aiMesh *mesh);

        bool initMaterials(const aiScene *pScene);

        std::vector<MeshEntity> m_meshs;
        std::vector<TexturePtr> m_textures;

        std::vector<OGLRenderBufferPtr> m_renderBuffers;

        std::string m_filename{};
    };

}

#endif